<template>
  <div class="list-container">
    <div class="list-item">
      <van-image
        fit="cover"
        round
        width="10rem"
        height="10rem"
        src="https://img.yzcdn.cn/vant/cat.jpeg"
      />
      <button open-type="contact" bindcontact="handleContact" session-from="sessionFrom" class="list-btn">联系客服</button>
    </div>
  </div>
</template>
<script setup>
import { onMounted } from 'vue'
import { onShow } from '@dcloudio/uni-app'
function handleContact(e) {
  // 小程序消息页面的路径 String
  console.log(e.detail.path)
  // 小程序消息指定的查询参数 Object
  console.log(e.detail.query)
}
onShow(() => {
  const Authorization = uni.getStorageSync('Authorization')
  if (!Authorization) {
    uni.switchTab({
      url: '/pages/person/person',
      success: () => {
        uni.showToast({
          title: '请先登录',
          icon: 'none',
        })
      },
    })
    // 阻止进一步的跳转操作
  }
})
</script>
<style scoped>
.list-container {
  padding: 10px;
}
.list-item {
  text-align: center;
  box-shadow: 6px 10px 10px 1px #e0e2e3;
  padding: 0 10px 10px 10px;
  border-radius: 10px;
}
.list-btn {
  background-color: #1989fa;
  color: #fff;
}
</style>
